Skip to content

Add line-height property - #12649

Open
tilladam wants to merge 1 commit into
slint-ui:masterfrom
tilladam:line-height-property
Open

Add line-height property#12649
tilladam wants to merge 1 commit into
slint-ui:masterfrom
tilladam:line-height-property

Conversation

@tilladam

Copy link
Copy Markdown
Contributor

Summary

  • Add a font-size-relative line-height property to Text, TextInput, and StyledText.
  • Apply the value consistently in Parley, the testing backend, and the software renderer.
  • Use the custom line height for measurement, elision, cursor positioning, and hit testing.
  • Document unitless and percentage values and retain the font's natural line height by default.

Rationale

Line height is a paragraph layout primitive shared by plain, editable, and styled text.
Slint already represents it internally with Parley's FontSizeRelative line height, so this exposes the existing capability without adding span-specific styling rules.

Testing

  • cargo test -p i-slint-core textlayout
  • SLINT_TEST_FILTER=line_height cargo test --manifest-path tests/Cargo.toml -p test-driver-rust
  • SLINT_TEST_FILTER=line_height cargo test --manifest-path tests/Cargo.toml -p test-driver-interpreter
  • cargo test -p i-slint-renderer-software custom_line_height_uses_requested_font_size
  • cargo test -p i-slint-compiler --features display-diagnostics --test syntax_tests
  • cargo check -p i-slint-renderer-software --no-default-features --features libm,i-slint-core/unsafe-single-threaded
  • cargo clippy --all --workspace
  • cargo doc -p i-slint-core --no-deps

Expose a font-size-relative line height on Text, TextInput, and StyledText.

Apply it consistently in Parley, testing, and software-renderer layout, including measurement, elision, and cursor positioning.

Document the property and cover the layout and hit-testing behavior.

ChangeLog: Add line-height to Text, TextInput, and StyledText.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant